package com.loiot.baqi;


import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;

import com.loiot.baqi.pojo.Tables;
import com.loiot.baqi.pojo.TgSuggestBugInfo;
import com.loiot.baqi.service.TgQqGroupService;
import com.loiot.baqi.service.TgSuggestBugInfoService;
import com.loiot.baqi.service.ZpDictionaryInfoService;
import com.loiot.baqi.utils.DBParams;
import com.loiot.baqi.utils.VirtualORM;
import com.loiot.commons.utils.FileUtil;
import com.loiot.commons.utils.JsonUtil;

@Component
public class mai {
  //@Autowired
  //UserMapper userMapper;
  public static void main(String[] args) throws Exception {
   /* TgSuggestBugInfoService service = (TgSuggestBugInfoService)context.getBean("tgSuggestBugInfoService");
    TgSuggestBugInfo b = new TgSuggestBugInfo();
    b.setAccountType(1);
    b.setContent("333");
    b.setTitle("111111");
    b.setCurrentUrl("22222");
    try {
		service.addTgSuggestBugInfo(b);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
    System.out.println(context);
  }*/
	/*ApplicationContext context = new ClassPathXmlApplicationContext("classpath:/spring/*.xml");
    ZpDictionaryInfoService service = (ZpDictionaryInfoService)context.getBean("zpDictionaryInfoService");
    List<Tables> list=new ArrayList<Tables>();
	try {
		list = service.queryTableList();
        FileUtil.writeStringToFile(new File("d:\\tables.txt"), JsonUtil.toJson(list));

	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
    System.out.println("list.sizp"+list.size());*/
	  
	  	TgSuggestBugInfo b = new TgSuggestBugInfo();
	  	b.setSuggestId(19l);
	    /*b.setAccountType(1);
	    b.setContent("555");
	    b.setTitle("555");
	    b.setCurrentUrl("555");
	    //b.setInTime(new Date());
	    b.setUpdateTime(new Date());*/
	    saveObject(b);
  }
  
  public  static void test1(){
	  try {
			  
	  } catch (Exception e) {
		  
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
  }
  
  public static  void   saveObject(Object o) throws Exception {
	  /*String tablesJson = FileUtil.readFileToString(new File("d:\\tables.txt"));
	  List<Tables> tables = JsonUtil.toList(tablesJson, Tables.class);
	  System.out.println(o.getClass().getSimpleName()); */
	 // DBParams dbParam=VirtualORM.deleteByCache(o);
	  ApplicationContext context = new ClassPathXmlApplicationContext("classpath:/spring/*.xml");
	  TgSuggestBugInfoService service = (TgSuggestBugInfoService)context.getBean("tgSuggestBugInfoService");
	  service.addTgSuggestBugInfo((TgSuggestBugInfo)o);
	  //String column = "update_time";
	
	  
	 // System.out.println(VirtualORM.convertToJavaProperty(column));
	  
	
	  
	  
	  
	  
    
  }
}